package cn.jesin.ssmss01.vo;

import cn.hutool.core.util.StrUtil;
import cn.jesin.ssmss01.common.OthType;
import lombok.Getter;
import lombok.Setter;

/**
 * @author 谷汉斌
 * @description AuthenticationBean类，用于封装 登录用户唯一标识与密码
 * @createTime 2024/7/22 下午8:11
 */
@Getter
@Setter
public class AuthenticationBean {

    private String username;
    private String password;
    private String phone;
    private String email;
    private String type;

    public String getOnlyId() {
        if (StrUtil.isNotBlank(this.phone)) {
            this.type = OthType.PHONE.getType();
            return this.phone;
        } else if (StrUtil.isNotBlank(this.email)) {
            this.type = OthType.EMAIL.getType();
            return this.email;
        }
        this.type = OthType.USERNAME.getType();
        return username;
    }
}